home *** CD-ROM | disk | FTP | other *** search
/ Video Toaster 4.2 / Video Toaster v4.2.iso / arexx / modeler / center1d.lwm < prev    next >
Text File  |  1993-12-13  |  824b  |  44 lines

  1. /* CMD: Center 1D
  2.  * Center Object on a single axis */
  3. /* By Arnie Cachelin © 1993 NewTek Inc. */
  4.  
  5. call addlib "LWModelerARexx.port", 0
  6. signal on error
  7. signal on syntax
  8.  
  9. ax.1='X'
  10. ax.2='Y'
  11. ax.3='Z'
  12.  
  13. call req_begin 'Center on 1 axis'
  14. id_ind = req_addcontrol("Axis", 'CH', 'X Y Z')
  15. if (~req_post()) then do
  16.     call req_end
  17.     exit
  18. end
  19. ind = req_getval(id_ind)
  20. call req_end
  21.  
  22. t=CenterAx(Ax.ind)
  23. exit
  24.  
  25. syntax:
  26. error:
  27.     t=Notify(1,'!Rexx Script Error','@'ErrorText(rc),'Line 'SIGL)
  28.     exit
  29.  
  30. CenterAx: Procedure
  31.   arg A
  32.   box=boundingbox()  /* Should check out empty list ...  */
  33.   parse var box n x1 x2 y1 y2 z1 z2
  34.   cx=-(x2+x1)/2
  35.   cy=-(y2+y1)/2
  36.   cz=-(z2+z1)/2
  37.   say A cx cy cz
  38.   if ~pos(upper(A),'X') then cx=0
  39.   if ~pos(upper(A),'Y') then cy=0
  40.   if ~pos(upper(A),'Z') then cz=0
  41.   say cx cy cz
  42.   call MOVE(cx cy cz)
  43.   return box
  44.